package cn.iocoder.yudao.module.biz.dal.mysql.zmorder;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.biz.dal.dataobject.zmorder.ZmOrderDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.biz.controller.admin.zmorder.vo.*;

/**
 * 订单报 Mapper
 *
 * @author 支付免押
 */
@Mapper
public interface ZmOrderMapper extends BaseMapperX<ZmOrderDO> {

    default PageResult<ZmOrderDO> selectPage(ZmOrderPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ZmOrderDO>()
                .eqIfPresent(ZmOrderDO::getSubCommpany, reqVO.getSubCommpany())
                .eqIfPresent(ZmOrderDO::getBizType, reqVO.getBizType())
                .eqIfPresent(ZmOrderDO::getOrderNo, reqVO.getOrderNo())
                .likeIfPresent(ZmOrderDO::getAgentName, reqVO.getAgentName())
                .eqIfPresent(ZmOrderDO::getBizCode, reqVO.getBizCode())
                .likeIfPresent(ZmOrderDO::getUserName, reqVO.getUserName())
                .eqIfPresent(ZmOrderDO::getZmOrderNo, reqVO.getZmOrderNo())
                .eqIfPresent(ZmOrderDO::getFrozenAmt, reqVO.getFrozenAmt())
                .eqIfPresent(ZmOrderDO::getOrderStatus, reqVO.getOrderStatus())
                .betweenIfPresent(ZmOrderDO::getCompleteTime, reqVO.getCompleteTime())
                .betweenIfPresent(ZmOrderDO::getOrderTime, reqVO.getOrderTime())
                .betweenIfPresent(ZmOrderDO::getOrderCancelTime, reqVO.getOrderCancelTime())
                .eqIfPresent(ZmOrderDO::getFrozenStatus, reqVO.getFrozenStatus())
                .eqIfPresent(ZmOrderDO::getContractPeriod, reqVO.getContractPeriod())
                .eqIfPresent(ZmOrderDO::getExpiration, reqVO.getExpiration())
                .betweenIfPresent(ZmOrderDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ZmOrderDO::getId));
    }

}